HA$PBExportHeader$u_cst_mmaqmcomp_cabedet.sru
forward
global type u_cst_mmaqmcomp_cabedet from u_cst_mantocabedet
end type
end forward

global type u_cst_mmaqmcomp_cabedet from u_cst_mantocabedet
end type
global u_cst_mmaqmcomp_cabedet u_cst_mmaqmcomp_cabedet

on u_cst_mmaqmcomp_cabedet.create
int iCurrent
call super::create
end on

on u_cst_mmaqmcomp_cabedet.destroy
call super::destroy
end on

event ue_nuevo;call super::ue_nuevo;long ll_movimiento
string ls_transaccion
ll_movimiento=0
sqlca.Usp_GetIdTablaINT(is_tabla,ll_movimiento)
dw_1.object.idmaqcomp[1]=ll_movimiento
//dw_1.object.idcentro[1]=istr_parm.integer_parm[1]
//dw_1.object.idalma[1]=istr_parm.integer_parm[2]
//dw_1.object.fdocumento[1] = today()
//dw_1.object.fproceso[1] = today()
//dw_1.object.idtrans[1] = 1
//dw_1.object.tdocumento[1] = of_getTDocumento()
//dw_1.object.iddocu[1]=5
end event

event ue_agregar;integer li_row

li_row =  dw_3.rowcount() 
dw_3.scrolltorow(dw_3.insertrow( 0))
if li_row = 0 then
	dw_3.object.idindice [1]=	1
else
	dw_3.object.idindice [dw_3.rowcount()]=	dw_3.object.idindice [li_row]+1
end if
dw_3.object.idmaq [dw_3.rowcount()]=	dw_1.object.idmaq [1]
dw_3.object.idcomp [dw_3.rowcount()]=	dw_1.object.idcomp [1]
//dw_3.object.idindice [dw_3.rowcount()]=


//dw_3.GetChild("iditem", dwc);dwc.reset()
//gdc_mitem1.RowsCopy(gdc_mitem1.GetRow(), gdc_mitem1.RowCount(), Primary!, dwc, 1, Primary!)
//
end event

event ue_grabar_previo;long ll_movimiento
integer li_fila



CHOOSE CASE UPPER(is_button)
	case 'NUEVO'
		ll_movimiento=0
		sqlca.Usp_GetIdTablaINT(is_tabla,ll_movimiento)
		dw_1.object.idmaqcomp  [1]=ll_movimiento
			//[1] =today()
		//event ue_sumar()
		for li_fila =1 to dw_3.rowcount( )
				dw_3.object.idindice         [li_fila] = li_fila
				dw_3.object.idmaqcomp   [li_fila] = dw_1.object.idmaqcomp  [1]
				dw_3.object.idMaq           [li_fila]  =  dw_1.object.idMaq  [1]
				dw_3.object.idcomp         [li_fila] = dw_1.object.idcomp  [1]
				
		next
	case 'EDITAR'
		for li_fila =1 to dw_3.rowcount( )
				dw_3.object.idmaqcomp   [li_fila] = dw_1.object.idmaqcomp  [1]
				//dw_3.object.idmovimiento  [li_fila] = dw_1.object.idmovimiento  [1]
				//dw_3.object.fproceso         [li_fila] =	dw_1.object.fproceso         [1] 
//				dw_3.object.idcentro          [li_fila] =	dw_1.object.idcentro         [1] 
//				dw_3.object.idalma            [li_fila] =	dw_1.object.idalma         [1] 
//				dw_3.object.idtrans            [li_fila] =	dw_1.object.idtrans         [1] 
//				dw_3.object.idmoneda        [li_fila] =	dw_1.object.idMoneda         [1] 
		next
		//DELETE FROM MKARDEX WHERE IDMOVIDOCU = :il_codigo;
		
		
END CHOOSE


end event

event ue_setdwc;//choose case is_tabla
//	case 'MMOVIMIENTO'
		dw_2.GetChild("idmaq", dwc);dwc.reset();	dwc.settransobject( sqlca);	dwc.retrieve( )
		dw_2.GetChild("idcomp", dwc);dwc.reset();	dwc.settransobject( sqlca);	dwc.retrieve( )
		dw_4.GetChild("idcaract", dwc);dwc.reset();	dwc.settransobject( sqlca);	dwc.retrieve( )
			

//	End Choose
//commit;
end event

type dw_5 from u_cst_mantocabedet`dw_5 within u_cst_mmaqmcomp_cabedet
end type

type dw_4 from u_cst_mantocabedet`dw_4 within u_cst_mmaqmcomp_cabedet
end type

type dw_3 from u_cst_mantocabedet`dw_3 within u_cst_mmaqmcomp_cabedet
end type

type st_det2 from u_cst_mantocabedet`st_det2 within u_cst_mmaqmcomp_cabedet
end type

type st_det1 from u_cst_mantocabedet`st_det1 within u_cst_mmaqmcomp_cabedet
end type

type st_titulo from u_cst_mantocabedet`st_titulo within u_cst_mmaqmcomp_cabedet
end type

type dw_2 from u_cst_mantocabedet`dw_2 within u_cst_mmaqmcomp_cabedet
end type

type uo_toolbarstrip from u_cst_mantocabedet`uo_toolbarstrip within u_cst_mmaqmcomp_cabedet
end type

event uo_toolbarstrip::constructor;this.of_AddItem('Grabar', 'Save!')
this.of_AddItem('Editar', '..\IMG\ICO\edit.ico')
this.of_AddItem('Anular', '..\IMG\ICO\Error.ico')
this.of_AddItem('Agregar', 'Insert5!')
this.of_AddItem('Eliminar Fila', 'DeleteRow!')
this.of_AddItem('Cancelar', 'Undo!')
//this.of_AddItem('Imprimir', 'Print!')

//opciones en estado invisible
this.of_setvisible( 'Grabar', false)
this.of_setvisible( 'Agregar', false)
this.of_setvisible( 'Eliminar Fila', false)
this.of_setvisible( 'Cancelar', false)
//this.of_setvisible('Imprimir', false)
//esto es para mostar los textos
this.of_DisplayText(true)
end event

type dw_1 from u_cst_mantocabedet`dw_1 within u_cst_mmaqmcomp_cabedet
end type

type uo_1 from u_cst_mantocabedet`uo_1 within u_cst_mmaqmcomp_cabedet
end type

